package com.ruoyi.statistics.controller;


import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.statistics.domain.HomeStatistics;
import com.ruoyi.statistics.service.HomeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RequiredArgsConstructor
@RestController
@RequestMapping("/home")
public class HomeController {

    private final HomeService homeService;


    /**
     * 查询头部数据
     *
     */
    @GetMapping("/homeData")
    public R<HomeStatistics> selectHomeHead(HomeStatistics homeStatistics) {
        homeStatistics.setQueryTime(DateUtils.getNowDate());
        return R.ok(homeService.homeHead(homeStatistics));
    }
    /**
     * 查询团对业绩
     *
     */
    @GetMapping("/teamData")
    public R<List<HomeStatistics>> selectTeamRevenueDataList(HomeStatistics homeStatistics) {
        homeStatistics.setQueryTime(DateUtils.getNowDate());
        return R.ok(homeService.teamYjData(homeStatistics));
    }
    /**
     * 查询个人业绩
     *
     */
    @GetMapping("/personData")
    public R<List<HomeStatistics>> selectPersonRevenueDataList(HomeStatistics homeStatistics) {
        homeStatistics.setQueryTime(DateUtils.getNowDate());
        return R.ok(homeService.personYjData(homeStatistics));
    }

    /**
     * 查询团对业绩
     *
     */
    @GetMapping("/yearQuota")
    public R<List<HomeStatistics>> selectYearQuota(HomeStatistics homeStatistics) {
        return R.ok(homeService.yearQuota(homeStatistics));
    }

    /**
     * 查询当天添加记录
     *
     */
    @GetMapping("/atDayRecord")
    public R<List<HomeStatistics>> atDayRecord(HomeStatistics homeStatistics) {
        return R.ok(homeService.atDayRecord(homeStatistics));
    }

}
